<template>
    <div>
        <van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
            <van-swipe-item v-for="image in images" :key="image">
                <img :src="image" />
            </van-swipe-item>
        </van-swipe>
    </div>
        <van-grid :column-num="4">
            <van-grid-item v-for="(item, index) in arr" :key="index" :icon="item.image_src" />
        </van-grid>
        <div v-for="(item, index) in brr" :key="index">
            <img :src="item.floor_title.image_src" alt="">
            <div v-for="(items, index) in item.product_list" :key="index">
                <img :src="items.image_src" alt="">
            </div>
        </div>
</template>

<script setup>
import { ref } from 'vue';
import axios from 'axios';
let arr = ref([])
let brr = ref([])
const images = [
    'https://fastly.jsdelivr.net/npm/@vant/assets/apple-1.jpeg',
    'https://fastly.jsdelivr.net/npm/@vant/assets/apple-2.jpeg',
];
axios.get('https://api-hmugo-web.itheima.net/api/public/v1/home/catitems').then(res => {
    arr.value = res.data.message
})
axios.get('https://api-hmugo-web.itheima.net/api/public/v1/home/floordata').then(res => {
    brr.value = res.data.message
})
</script>

<style>
.my-swipe .van-swipe-item {
    width: 400px;
    height: 200px;
}

img {
    width: 400px;
    height: 200px;
}
</style>